package com.fenxiangle.yueding.feature.publish.model;

import com.fenxiangle.yueding.entity.bo.AliPayBo;
import com.fenxiangle.yueding.entity.bo.MyAccountBo;
import com.fenxiangle.yueding.entity.bo.PageBo;
import com.fenxiangle.yueding.entity.bo.PayBo;
import com.fenxiangle.yueding.entity.bo.PublishBo;
import com.fenxiangle.yueding.entity.bo.PublishDemandBo;
import com.fenxiangle.yueding.feature.publish.contract.PayContract;
import com.fenxiangle.yueding.feature.publish.contract.PublishContract;
import com.fenxiangle.yueding.feature.publish.dependencies.mine.DaggerPublishModelComponent;
import com.fenxiangle.yueding.feature.publish.dependencies.pay.DaggerPayModelComponent;
import com.fenxiangle.yueding.framework.api.ApiLib;
import com.fenxiangle.yueding.framework.api.UserApi;
import com.suozhang.framework.component.http.RxDataProcessFactory;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class PayModel implements PayContract.Model {

    @Inject
    UserApi api;


    @Inject
    public PayModel() {
        DaggerPayModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<AliPayBo> getPayData(PayBo payBo) {
        return api.getPayData(payBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<AliPayBo> rechargeCredit(PayBo payBo) {
        return api.rechargeCerdit(payBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<MyAccountBo> getMyAccount() {
        return api.myAccount().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
